#include "pic.h"
#include "type.h"
void out_byte(u16,u8);
void dispStr(char* );
//初始化PIC
void init_pic(){
	out_byte(0x20,M_ICW1);
	out_byte(0xA0,S_ICW1);
	out_byte(0x21,M_ICW2);
	out_byte(0xA1,S_ICW2);
	out_byte(0x21,M_ICW3);
	out_byte(0xA1,S_ICW3);
	out_byte(0x21,M_ICW4);		
	out_byte(0xA1,S_ICW4);
	out_byte(0x21,0xFF);
	out_byte(0xA1,0xFF);
}
void exception_handler(int vec_no,int err,int eip,int cs,int eflags){
	char* str[]={"#Divide Error","#Debug Exception","#Reserved ","#Breakpoint","#Overflow","Bounds Check",
		     "#Invad Opcode","#Coprocessor Not Available","#Double Fault","#Coprocessor Segment Overrun","#Invalid TSS",
		     "#Segment Not Present","#Stack Exception"," #General Protection Exception",  "#Page Fault","#Reserved",
		     "#Reserved","#Coprocessor Error"
		    };
	dispStr("Exception:");
	dispStr(str[vec_no]);
}

void handler(){
	dispStr("\nint cautch\n");
	out_byte(0x20,EOI);
}
/*void clock_handler(){
	dispStr("clock start");
	dispStr("....");
	out_byte(0x20,EOI);
}*/
